<?php

use think\facade\Route;

Route::rest([
    'index'   => ['GET', '', 'list'],
    'read' => ['GET', '/:id', 'detail'],
    'save' => ['POST', '', 'add'],
    'update' => ['PUT', '/:id', 'edit'],
    'delete' => ['DELETE', '/:id', 'delete'],
]);

// 获取登录/绑定二维码
Route::get('admin/user/getQrcode', 'admin.user/getQrcode');
// 检查登录/绑定扫码状态
Route::get('admin/user/checkScan', 'admin.user/checkScan');

Route::group(function () {
    // 选择素材
    Route::get('admin/material/select', 'admin.material/select');

    Route::group(function () {
        Route::any('admin/config/officialAccount', 'admin.config/officialAccount');

        // 微信菜单管理
        Route::post('admin/menu/copy/:id', 'admin.menu/copy');
        Route::post('admin/menu/publish/:id', 'admin.menu/publish');
        Route::resource('admin/menu', 'admin.menu');

        // 粉丝管理同步
        Route::any('admin/fans/sync', 'admin.fans/sync');
        Route::resource('admin/fans', 'admin.fans');

        // 自动回复
        Route::resource('admin/reply', 'admin.reply');

        // 素材管理
        Route::resource('admin/material', 'admin.material');
    })->middleware('check_rule', 'admin');
})->middleware('check_login', 'admin');
